/* cmdmap */

#ifndef CMDMAP_H_
#define CMDMAP_H_

#define CMDMAP_CAP 64

typedef int(*COMMAND_HANDLER)(char *, int);

typedef COMMAND_HANDLER val_t;

typedef struct map_entry{
	char * key;
	val_t val;
} map_entry_t;

typedef struct cmdmap{
	map_entry_t *entries;
	int cap;
	int len;
} cmdmap_t;

cmdmap_t * cmdmap_new();

int cmdmap_free(cmdmap_t * map);

int cmdmap_add(cmdmap_t * map,  char *key, val_t val);

val_t cmdmap_find(cmdmap_t * map, char *key);

int cmdmap_sort(cmdmap_t * map);
#endif /* CMDMAP_H_ */
